Global Index
HTML5 JS API Index > SVG Tutorials & Specs

SVGColor

Extends CSSValue.

Extended by SVGPaint, SVGPaint

The SVGColor interface corresponds to color value definition for properties ‘stop-color’, ‘flood-color’ and ‘lighting-color’ and is a base class for interface SVGPaint. It incorporates SVG's extended notion of color, which incorporates ICC-based color specifications.

Properties
const unsigned short
SVG_COLORTYPE_CURRENTCOLOR = 3
Corresponds to when keyword currentColor has been specified.
const unsigned short
SVG_COLORTYPE_RGBCOLOR = 1
An sRGB color has been specified without an alternative ICC color specification.
const unsigned short
SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2
An sRGB color has been specified along with an alternative ICC color specification.
const unsigned short
SVG_COLORTYPE_UNKNOWN = 0
The color type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
unsigned short
colorType
The type of the value as specified by one of the SVG_COLORTYPE_* constants defined on this interface.
SVGICCColor
iccColor
The alternate ICC color specification.
RGBColor
rgbColor
The color specified in the sRGB color space.
Operations
void
setColor(unsigned short colorType, DOMString rgbColor, DOMString iccColor)
Sets the color value as specified by the parameters. If colorType requires an RGBColor, then rgbColor must be a string that matches <color>; otherwise, rgbColor. must be null. If colorType requires an SVGICCColor, then iccColor must be a string that matches <icccolor>; otherwise, iccColor must be null.
void
setRGBColor(DOMString rgbColor)
Modifies the color value to be the specified sRGB color without an alternate ICC color specification. ParametersDOMString rgbColor A string that matches <color>, which specifies the new sRGB color value. ExceptionsSVGException, code SVG_INVALID_VALUE_ERR Raised if rgbColor does not match <color>.
void
setRGBColorICCColor(DOMString rgbColor, DOMString iccColor)
Modifies the color value to be the specified sRGB color with an alternate ICC color specification. ParametersDOMString rgbColor A string that matches <color>, which specifies the new sRGB color value. DOMString iccColor A string that matches <icccolor>, which specifies the alternate ICC color specification.